<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" trimDirectiveWhitespaces="true"%>
<!DOCTYPE html>
<html>
<head>
<title>上传</title>
<%@ include file="/WEB-INF/views/include.inc.jsp"%>
<link href="${contextPath }/styles/bootstrap-fileinput/css/fileinput.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
  <c:import url="/main/header"/>
  
  <div class="main2">
    <div class="content2">
	  <div class="content-wrap news2">
	    <div class="widbox widbox2">
	      <div class="sctop">附件上传</div>
	      <div class="scbox">
	        <!--
	        <input type="file" id="file" name="file" />
	        <input type="hidden" name="url" />
	        <div class="progress" style="display:none;">
	  		</div>
	  		-->
		    <input id="file-api" name="file" type="file" multiple class="file-loading">
	      </div>
	    </div>
	  </div>
    </div>
  </div>
</div>
<%--
<script src="${contextPath }/styles/jquery/jquery-1.8.3.min.js"></script>
<script src="${contextPath }/styles/ajaxfileupload/ajaxfileupload.js" type="text/javascript"></script>
<script src="${contextPath }/styles/public/js/upload_api.js" type="text/javascript"></script>
--%>
<script src="${contextPath }/styles/bootstrap-fileinput/js/fileinput.min.js"></script>
<script src="${contextPath }/styles/bootstrap-fileinput/js/locales/zh.js"></script>
<script>
$(function(){
	$("#file-api").fileinput({
        language: 'zh',
        uploadUrl: path + "/file/apiUpload",
        browseClass: "btn btn-primary",
        allowedFileTypes: ['image', 'html', 'text', 'video', 'audio', 'flash', 'object'],
        //allowedFileExtensions : ['jpg', 'png','gif'],// 接收的文件后缀
	    showUpload: true,// 是否显示上传按钮
	    showCaption: false,// 是否在input显示文件路径
	    //uploadExtraData: {"id": 1, "fileName":'123.mp3'},
	    browseClass: "btn btn-primary",// 按钮样式
	    previewFileIcon: "<i class='glyphicon glyphicon-king'></i>",
	    dropZoneEnabled: true,// 是否显示拖拽区域
	    maxFileSize: 1024 * 10,// 单位为kb，如果为0表示不限制文件大小
        maxFileCount: 5,// 表示允许同时上传的最大文件个数
        validateInitialCount: true,
        msgFilesTooMany: "选择上传的文件数量({n}) 超过允许的最大数值{m}！"
    }).on("fileuploaded", function (event, data) {
        success(data.response.message);
    });

	/*
	$('#file').die().live('change', function() {
		if (hasUpload == true) {
			error("正在上传，请稍后再试！");
			return false;
		}
		var file = $("#file").val();
		if (file == null || file == "") {
			error("请选择文件！");
			return false;
		}
		var extStart = file.lastIndexOf(".");
		var ext = file.substring(extStart, file.length).toLowerCase();
		if (ext == ".exe") {
			error("文件的扩展名不能是：exe");
			return false;
		}
		oTimer = setInterval("getProgress()", 100);
		ajaxFileUpload('file');
	});
	*/
});
</script>
</body>
</html>